<!--   
Persistent Digital Archives and Library System (PeDALS) 
(c) 2008 - All Rights Reserved
//-->
<?php
if ((is_file('includes\config.php')) and (is_file('includes\header.php')) and (is_file('includes\footer.php')) and (is_file('includes\style.css'))) {
	include 'includes\config.php';
} else {
	echo "Unable to locate one or all of the include files.  Please contact your PeDALS Administrator.";
	die;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta name="description" content="Persistent Digital Archives and Library System" />
    <title>PeDALS Web Administration: Acquisitions</title>
    <link rel="shortcut icon" href="images/favicon.ico" />
    <link href="includes/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include 'includes\header.php'; ?>
<div id="breadcrumb-container">
  <div id="breadcrumb"><a href="index.php" title=Home page">Home</a> / Acquisitions</div>
  <div id="breadcrumb-side"><form name="search" action="search.php"><input type="text" name="q" width="50"/><input type="submit" value="Go" /></form><a href="advSearch.php" title="Advanced Search" alt="Advanced Search">Advanced Search</a>
  </div>
  <div class="clear"></div>
</div>
<!-- 
  CONTENT
  -->
<div id="content-container">
  <!-- 
	SIDE COLUMN
	-->
  <div id="content-side">
    <ul class="link-list-vertical">
      <li><a href="acqNew.php" title="Add a new acquisition to PeDALS.">Add Acquisition</a></li>
      <li><a href="acqSummaryStatus.php" title="View the ingest status of acquisitions.">Acquisitions by Status</a></li>
    </ul>
  </div>
  <!-- 
	MAIN COLUMN
	-->
  <div id="content"><a name="maincontent" id="maincontent"></a>
    <h1>Acquisitions</h1>

<?php	
 	$tsql = "{call PAC_GetSeriesAcquisitions}";

 	/* Create the statement  */
	$getData = sqlsrv_prepare( $conn, $tsql);
	if( $getData === false ) {
		 echo "Error in preparing statement. Please contact your PeDALS Administrator.";
		 die;
	}

	/* Execute the statement */
	if( sqlsrv_execute( $getData))
	{ /*echo "Statement executed";*/
	} else {
		 echo "Error in executing statement. Please contact your PeDALS Administrator.";
		 die;
	}
    
    echo "<table class=\"table\" border=\"1\" cellspacing=\"0\" summary=\"Table listing all the acquisitions set up in PeDALS\">";
	echo "<thead><tr>";
	echo "<th scope=\"col\">Provenance</th>";
	echo "<th scope=\"col\">Series</th>";
    echo "<th scope=\"col\">Submitted to PeDALS</th>";	
	echo "<th scope=\"col\">Acquisition Accession Number</th>";
	echo "<th scope=\"col\">View</th>";
	echo "<th scope=\"col\">Edit</th>";
    echo "</tr></thead><tbody>";

	/* Start counting rows in the result set */
	$rowCount = 0;

	/* Fetch the data */
	while (sqlsrv_fetch( $getData ))
	{	
		$provname = sqlsrv_get_field($getData, 0);
		$seriestitle = sqlsrv_get_field($getData, 1);
		$acqingestdate = sqlsrv_get_field($getData, 2);	
		$acqreceivedate = sqlsrv_get_field($getData, 3);	
		$acqid = sqlsrv_get_field($getData, 4);
		$seriesaccno = sqlsrv_get_field($getData, 5);
		
		echo "<tr>";
		echo "<td align=\"left\" valign=\"top\" >".$provname."</td>";				
		echo "<td align=\"left\" valign=\"top\" >".$seriestitle."</td>";				
		echo "<td align=\"center\" valign=\"top\" >";
		echo "<a title=\"".$acqingestdate."\"";
		echo " alt=\"".$acqingestdate."\"";
		echo " href=acqDetail.php?acq=".$acqid."";
		echo ">".$acqingestdate."</a>";
		echo "</td>";		
		echo "<td align=\"center\" valign=\"top\" >".$seriesaccno."</td>";					
		echo "<td align=\"center\" valign=\"top\" >";
		echo "<a title=\"View\"";
		echo " alt=\"View\"";
		echo " href=acqDetail.php?acq=".$acqid."";
		echo "><img src='images/view.png' border=0/></a></td>";
		echo "<td align=\"center\" valign=\"top\" >";
		echo "<a title=\"Edit\"";
		echo " alt=\"Edit\"";
		echo " href=acqEdit.php?acq=".$acqid."";
		echo "><img src='images/edit.png' border=0/></a></td>";		
		echo "</tr>";	
	
		$rowCount++;
    }	
	
	if( $rowCount == 0 ) { 
	    echo "<tr><td colspan=\"5\"><h4>There are no acquisitions set up yet.</h4></td></tr>";
    	}
		
	echo "</tbody></table>";		
	
    sqlsrv_free_stmt( $getData );	
	sqlsrv_close( $conn);

	include 'includes\footer.php'; 
	
	?>
  </div>
</div>
</body>
</html>